//example for using the mina library 
#include "tcp_handler.h"
#include "tcp_acceptor.h"
#include "tcp_acceptor_config.h"
#include <boost/shared_ptr.hpp>
#include "tcp_packet_filter.h"

#include "udp_acceptor.h"
#include "udp_handler.h"
#include "udp_acceptor_config.h"

#include "tcp_connector.h"
#include "tcp_connector_config.h"
using namespace vpm::mina;


int main(int, char *[])
{

	TcpHandler tcpHandler;
	TcpAcceptorConfig config; 

	boost::shared_ptr<TcpPacketFilter> packetFilter(new TcpPacketFilter()); 
	config.get_input_chain().add_filter(packetFilter);

	IoAcceptor * pAcceptor = new TcpAcceptor<>(config,tcpHandler);

	pAcceptor->bind(ServiceUrl("tcp://172.24.202.106:8000"));

	UdpHandler udpHandler; 
	UdpAcceptorConfig udpConfig; 

	IoAcceptor * pUdpAcceptor = new UdpAcceptor(udpConfig, udpHandler);
	pUdpAcceptor->bind(ServiceUrl("udp://0.0.0.0:9000"));

	TcpConnectorConfig tcpConnectorConfig; 
	IoConnector * pTcpConnector = new TcpConnector(tcpConnectorConfig,tcpHandler); 
	pTcpConnector->connect(ServiceUrl("tcp://172.24.202.106:9000"));
	

	//while (true)
	{
		Sleep(100000);
	}
	int ch = getchar(); 

	return 0; 
}
